1. Field of the Invention
The present invention relates generally to multimedia data service in a mobile communication terminal, and more particularly to an H.263/MPEG video encoder using discrete cosine transform (DCT).
2. Description of the Related Art
In a mobile communication terminal capable of two-way moving image communication, a video encoder controls a bit rate to enable the terminal to perform communication at a fixed bit rate. Currently, 3GPP (third Generation Partnership Project) and domestic mobile communication providers have prepared standards recommending that H.263 and MPEG (Motion Picture Experts Group) 4 should be used as encoders for a moving image. Because the compression principle of standard video encoders is based on a discrete cosine transform (DCT) and motion prediction, a compression ratio changes according to the characteristics of moving images. However, it has been very difficult to achieve the technology for promptly controlling bit rates according to the changing compression ratios. Therefore, the specifications of the standards propose a method of controlling the compression ratio of a moving image by changing a quantization value in a quantizing step.
FIG. 1 is a block diagram illustrating an example of a conventional H.263/MPEG video encoder. As illustrated in FIG. 1, a conventional H.263/MPEG video encoder includes an original image memory 101, a first switch 103, a discrete cosine transform (DCT) section 104, a quantization (Q) section 105, an inverse quantization (IQ) section 106, an inverse discrete cosine transform (IDCT) section 107, a coupler 110, a recon memory 111, a motion estimation section 112, a motion compensation section 113, a motion compensated (Mced) memory 114, a quantization parameter (QP) memory 116, a Discrete Cosine Transformed and Quantisized (DCTQ) memory 108, and a variable length coding (VLC) section 109. The original image memory 101 receives image information by the frame and stores the received moving image. The first switch 103 transmits a first frame of the image information from the original image memory 101 directly to the DCT section 104, and transmits the other frames of the image information from the original image memory 101 indirectly to the DCT section 104 through an operation 102 with motion-compensated information, which is stored in the Mced memory 114.
The DCT section 104 performs a discrete cosine transform. The quantization (Q) section 105 quantizes the output of the DCT section 104. The inverse quantization (IQ) section 106 inverse-quantizes quantized data. The IDCT section 107 performs an inverse discrete cosine transform for the output of the inverse quantization section 106. The coupler 110 couples the motion-compensated information of a previous fame (n−1) stored in the Mced memory 114 and information of a current frame (n) decoded by the IDCT section 107. The recon memory 111 stores the decoding information for the next frame (n). The motion prediction section 112 receives the decoding information of a previous frame (n−1) stored in the recon memory 111 and an original image of a current frame (n), and then outputs a differential image and a motion vector for motion estimation. The motion compensation section 113 receives the output of the motion estimation section 112 and decoding information of a previous frame (n−1) stored in the recon memory 111 and compensates motion of the decoding information of the previous frame. The Mced memory 114 stores information of a previous frame (n−1), which has been motion-compensated.
The QP memory 116 transmits quantization values for controlling bit rates to the quantization section 105, which are different according to the input image information, one of ‘Intra’, ‘Inter’, and ‘Skipped’. The DCTQ memory 108 stores data encoded by the quantization section 105. The VLC section 109 performs entropy coding to assign a lower bit rate to a more-frequently appearing value and assign a higher bit rate to a less-frequently appearing value.
In the encoder described above, when a quantization value is determined in the quantization section 105, all values less than the determined quantization value become ‘0’. That is, the quantization values are maintained within a predetermined range, and each of coefficients in the discrete-cosine-transformed blocks is divided by a quantization value so that a quotient is obtained. Accordingly, if the quantization value is large, the obtained quotient has a large error. As a result, image quality deteriorates but the effect of compression increases. In contrast, if the quantization value is small, the obtained quotient has a small error. As a result of this, image quality does not deteriorate but the effect of compression decreases. Accordingly, the method of determining a quantization value and a range of the coefficients to be processed as loss in the quantization is an important issue.
Also, considering the output of the video encoder illustrated in FIG. 1, in which encoded video data is output in H.263 bit streams, in order to control bit rates according to the H.263 CODEC standard, the difference between an encoded bit rate and an assigned bit rate of a predetermined bandwidth is calculated while encoding is performed by the minimum macroblock or more, and then the next quantization value increases or decreases according to the difference.
FIGS. 2A to 2C are exemplary views of encoding units for bit-rate control. More specifically, FIG. 2A illustrates encoding by the frame, in which bit-rate control for one frame is limited to one time, and FIG. 2B illustrates encoding by the GOB (Group of Blocks), in which bit-rate control for one frame is performed 9 times. For example, in the case of QCIF (Quarter Common Intermediate Format), one macroblock consists of 6 blocks, and one GOB consists of 11 macroblocks. FIG. 2C illustrates encoding by the macroblock, in which bit-rate control for one frame is performed 9×11 times.
In general, because quantization values, in the best case, can be renewed by the macroblock as illustrated in FIG. 2C, it is best that bit-rate control is performed on the macroblock unit basis. However, because of the characteristics of DCT hardware blocks influenced by these quantization values, an accompanying overhead becomes too large, and it is difficult to realize a system for this control.
Also, in the case in which bit-rate control is performed on the frame unit basis as illustrated in FIG. 2A, loss can become too large because the bit-rate control is too limited, and also lots of unnecessary calculations may occur. As a result, this method is seldom used.
Therefore, bit-rate control by the GOB, as illustrated in FIG. 2B, is generally used. In performing the bit-rate control by the GOB, motion estimation is performed for the entire of an input frame to output a motion vector and a SAD (Sum of Absolute Difference). A coding type for each of macroblocks is determined by the macroblock by means of the SAD. A differential image according to a motion vector is generated for an Inter-type macroblock by the GOB. After the amount of bits generated by the GOB is checked, a bit rate is calculated, and a quantization value is renewed.
However, even the bit-rate control by the GOB causes a large change in the amount of bits. Therefore, during a large motion or a changed scene, the amount of bits increases, and the bit-rate control of nine times often causes bit rates to exceed a predetermined bandwidth.
In addition, during a small motion or a sequence scene, the amount of bits decreases, and the predetermined bandwidth is wasted.
Further, when a previous GOB consumes lots of bits, the amount of bits assigned for the next GOB becomes lacking, and the entire image quality deteriorates. Also, because the same quantization step is applied to the entire GOB, one region for which detailed description is necessary and the other region for which detailed description is unnecessary are not distinguished from each other. For example, when a sky and caption are quantized together, the sky becomes so precise and the caption becomes too vague to read. Also, the bit-rate control by the GOB causes a problem of periodically changing image quality. For example, excess of bit amount in a previous GOB→application of large quantization to a current GOB (deterioration of image quality)→large decrease of bit amount in the current GOB→application of small quantization to the next GOB (good image quality)→excess of bit amount in the next GOB.
Finally, because occurring bit amounts change greatly, buffers of an H.324M modem chip for transmission, as well as an encoder and a decoder, must be designed in large size.